package collection1;

import java.util.Arrays;
import java.util.List;

public class ArrayToList1 {
    public static void main(String[] args) {
        String[] array1={"one","two","three","four","five"};
        System.out.println("array1:"+ Arrays.toString(array1));

        //asList()方法会返回内部的ArrayList,内部直接引用给定数组array
        List<String> list1= Arrays.asList(array1);
        System.out.println("list1:"+list1);
        //对数组操作后，集合会相应改变
        array1[0]="six";
        System.out.println("array1:"+ Arrays.toString(array1));
        System.out.println("list1:"+list1);
        //对集合操作后，数组也会相应改变
        list1.set(3,"one");
        System.out.println("array1:"+ Arrays.toString(array1));
        System.out.println("list1:"+list1);
        //list1.add("!!!!");

    }
}
